package com.manhanlou.service;

import com.manhanlou.dao.MenuDao;
import com.manhanlou.domain.Menu;

import java.util.List;

/**
 * 完成Menu的各种操作
 *
 * @author wty
 * @date 2022/11/9 13:49
 */
public class MenuService {
    private MenuDao menuDao = new MenuDao();

    public List<Menu> queryMenu() {
        String sqlStr = "SELECT id,name,type,price FROM menu";
        List<Menu> list = menuDao.queryMulti(sqlStr, Menu.class);
        return list;
    }

    public Object queryMenuId(Integer id) {
        String sqlStr = "SELECT id FROM menu where id = ?";
        Object o = menuDao.queryScalar(sqlStr, id);
        return o;
    }

    public Menu queryMenu(Integer id) {
        String sqlStr = "SELECT id,name,type,price FROM menu where id = ?";
        Menu menu = menuDao.querySingle(sqlStr, Menu.class, id);
        return menu;
    }
}
